/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @signatureAlgorithm = 'v2';
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('trusted-server', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model DescribeBootRequest {
  propertyUuid?: string(name='PropertyUuid'),
}

model DescribeBootResponseBody = {
  gmtCreate?: string(name='GmtCreate'),
  gmtModified?: string(name='GmtModified'),
  id?: long(name='Id'),
  requestId?: string(name='RequestId'),
  whiteListAffiliation?: int32(name='WhiteListAffiliation'),
  whiteListDetail?: string(name='WhiteListDetail'),
}

model DescribeBootResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeBootResponseBody(name='body'),
}

async function describeBootWithOptions(request: DescribeBootRequest, runtime: Util.RuntimeOptions): DescribeBootResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.propertyUuid)) {
    query['PropertyUuid'] = request.propertyUuid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeBoot',
    version = '2020-06-13',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeBoot(request: DescribeBootRequest): DescribeBootResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeBootWithOptions(request, runtime);
}

model DescribeEventsRequest {
  createEndDate?: long(name='CreateEndDate'),
  createStartDate?: long(name='CreateStartDate'),
  currentPage?: int32(name='CurrentPage'),
  eventAffiliation?: int32(name='EventAffiliation'),
  eventLevel?: int32(name='EventLevel'),
  eventStatus?: int32(name='EventStatus'),
  eventType?: int32(name='EventType'),
  handleEndDate?: long(name='HandleEndDate'),
  handleStartDate?: long(name='HandleStartDate'),
  handleType?: int32(name='HandleType'),
  pageSize?: int32(name='PageSize'),
  propertyName?: string(name='PropertyName'),
  propertyPrivateIp?: string(name='PropertyPrivateIp'),
  propertyPublicIp?: string(name='PropertyPublicIp'),
  propertyUuid?: string(name='PropertyUuid'),
  suspect?: string(name='Suspect'),
  suspectSig?: string(name='SuspectSig'),
}

model DescribeEventsResponseBody = {
  currentPage?: int32(name='CurrentPage'),
  items?: [ 
    {
      accumulation?: string(name='Accumulation'),
      eventAffiliation?: string(name='EventAffiliation'),
      eventLevel?: string(name='EventLevel'),
      eventStatus?: string(name='EventStatus'),
      eventType?: string(name='EventType'),
      eventUuid?: string(name='EventUuid'),
      gmtCreate?: long(name='GmtCreate'),
      gmtHandle?: long(name='GmtHandle'),
      gmtModified?: long(name='GmtModified'),
      handleType?: string(name='HandleType'),
      propertyName?: string(name='PropertyName'),
      propertyPrivateIp?: string(name='PropertyPrivateIp'),
      propertyPublicIp?: string(name='PropertyPublicIp'),
      propertyUuid?: string(name='PropertyUuid'),
      suspect?: string(name='Suspect'),
      suspectSig?: string(name='SuspectSig'),
      suspectWhiteList?: string(name='SuspectWhiteList'),
    }
  ](name='Items'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  totalCount?: long(name='TotalCount'),
}

model DescribeEventsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeEventsResponseBody(name='body'),
}

async function describeEventsWithOptions(request: DescribeEventsRequest, runtime: Util.RuntimeOptions): DescribeEventsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.createEndDate)) {
    query['CreateEndDate'] = request.createEndDate;
  }
  if (!Util.isUnset(request.createStartDate)) {
    query['CreateStartDate'] = request.createStartDate;
  }
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.eventAffiliation)) {
    query['EventAffiliation'] = request.eventAffiliation;
  }
  if (!Util.isUnset(request.eventLevel)) {
    query['EventLevel'] = request.eventLevel;
  }
  if (!Util.isUnset(request.eventStatus)) {
    query['EventStatus'] = request.eventStatus;
  }
  if (!Util.isUnset(request.eventType)) {
    query['EventType'] = request.eventType;
  }
  if (!Util.isUnset(request.handleEndDate)) {
    query['HandleEndDate'] = request.handleEndDate;
  }
  if (!Util.isUnset(request.handleStartDate)) {
    query['HandleStartDate'] = request.handleStartDate;
  }
  if (!Util.isUnset(request.handleType)) {
    query['HandleType'] = request.handleType;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.propertyName)) {
    query['PropertyName'] = request.propertyName;
  }
  if (!Util.isUnset(request.propertyPrivateIp)) {
    query['PropertyPrivateIp'] = request.propertyPrivateIp;
  }
  if (!Util.isUnset(request.propertyPublicIp)) {
    query['PropertyPublicIp'] = request.propertyPublicIp;
  }
  if (!Util.isUnset(request.propertyUuid)) {
    query['PropertyUuid'] = request.propertyUuid;
  }
  if (!Util.isUnset(request.suspect)) {
    query['Suspect'] = request.suspect;
  }
  if (!Util.isUnset(request.suspectSig)) {
    query['SuspectSig'] = request.suspectSig;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeEvents',
    version = '2020-06-13',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeEvents(request: DescribeEventsRequest): DescribeEventsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeEventsWithOptions(request, runtime);
}

model DescribeInstanceRequest {
  propertyUuid?: string(name='PropertyUuid'),
}

model DescribeInstanceResponseBody = {
  extensions?: string(name='Extensions'),
  gmtCreate?: long(name='GmtCreate'),
  gmtModified?: long(name='GmtModified'),
  gmtRecentReport?: long(name='GmtRecentReport'),
  onlineStatus?: int32(name='OnlineStatus'),
  programExceptionNum?: int32(name='ProgramExceptionNum'),
  programTrustDetail?: string(name='ProgramTrustDetail'),
  programTrustStatus?: int32(name='ProgramTrustStatus'),
  programWhiteListId?: int32(name='ProgramWhiteListId'),
  programWhiteListName?: string(name='ProgramWhiteListName'),
  propertyAffiliation?: int32(name='PropertyAffiliation'),
  propertyName?: string(name='PropertyName'),
  propertyPrivateIp?: string(name='PropertyPrivateIp'),
  propertyPublicIp?: string(name='PropertyPublicIp'),
  propertyUuid?: string(name='PropertyUuid'),
  requestId?: string(name='RequestId'),
  systemExceptionNum?: int32(name='SystemExceptionNum'),
  systemTrustDetail?: string(name='SystemTrustDetail'),
  systemTrustStatus?: int32(name='SystemTrustStatus'),
  systemWhiteListId?: int32(name='SystemWhiteListId'),
}

model DescribeInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeInstanceResponseBody(name='body'),
}

async function describeInstanceWithOptions(request: DescribeInstanceRequest, runtime: Util.RuntimeOptions): DescribeInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.propertyUuid)) {
    query['PropertyUuid'] = request.propertyUuid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeInstance',
    version = '2020-06-13',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeInstance(request: DescribeInstanceRequest): DescribeInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInstanceWithOptions(request, runtime);
}

model GenerateAikcertRequest {
  aikName?: string(name='AikName'),
  aikPub?: string(name='AikPub'),
  ekCert?: string(name='EkCert'),
  ekPub?: string(name='EkPub'),
  nonceDigest?: string(name='NonceDigest'),
  propertyUuid?: string(name='PropertyUuid'),
}

model GenerateAikcertResponseBody = {
  requestId?: string(name='RequestId'),
  data?: {
    dataCredentialBlob?: string(name='dataCredentialBlob'),
    keyCredentialBlob?: string(name='keyCredentialBlob'),
  }(name='data'),
}

model GenerateAikcertResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GenerateAikcertResponseBody(name='body'),
}

async function generateAikcertWithOptions(request: GenerateAikcertRequest, runtime: Util.RuntimeOptions): GenerateAikcertResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.aikName)) {
    query['AikName'] = request.aikName;
  }
  if (!Util.isUnset(request.aikPub)) {
    query['AikPub'] = request.aikPub;
  }
  if (!Util.isUnset(request.ekCert)) {
    query['EkCert'] = request.ekCert;
  }
  if (!Util.isUnset(request.ekPub)) {
    query['EkPub'] = request.ekPub;
  }
  if (!Util.isUnset(request.nonceDigest)) {
    query['NonceDigest'] = request.nonceDigest;
  }
  if (!Util.isUnset(request.propertyUuid)) {
    query['PropertyUuid'] = request.propertyUuid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GenerateAikcert',
    version = '2020-06-13',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function generateAikcert(request: GenerateAikcertRequest): GenerateAikcertResponse {
  var runtime = new Util.RuntimeOptions{};
  return generateAikcertWithOptions(request, runtime);
}

model GenerateNonceRequest {
  aikName?: string(name='AikName'),
  ekCert?: string(name='EkCert'),
  ekPub?: string(name='EkPub'),
  propertyUuid?: string(name='PropertyUuid'),
}

model GenerateNonceResponseBody = {
  requestId?: string(name='RequestId'),
  data?: {
    credentialBlob?: string(name='CredentialBlob'),
  }(name='data'),
}

model GenerateNonceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GenerateNonceResponseBody(name='body'),
}

async function generateNonceWithOptions(request: GenerateNonceRequest, runtime: Util.RuntimeOptions): GenerateNonceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.aikName)) {
    query['AikName'] = request.aikName;
  }
  if (!Util.isUnset(request.ekCert)) {
    query['EkCert'] = request.ekCert;
  }
  if (!Util.isUnset(request.ekPub)) {
    query['EkPub'] = request.ekPub;
  }
  if (!Util.isUnset(request.propertyUuid)) {
    query['PropertyUuid'] = request.propertyUuid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GenerateNonce',
    version = '2020-06-13',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function generateNonce(request: GenerateNonceRequest): GenerateNonceResponse {
  var runtime = new Util.RuntimeOptions{};
  return generateNonceWithOptions(request, runtime);
}

model IgnoreEventsRequest {
  eventUuids?: string(name='EventUuids', example='["14e055e60c8c19264a4c0045feee****"]'),
  handleStyle?: int32(name='HandleStyle', example='1'),
}

model IgnoreEventsResponseBody = {
  data?: string(name='Data', example='{}'),
  requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3****'),
}

model IgnoreEventsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: IgnoreEventsResponseBody(name='body'),
}

async function ignoreEventsWithOptions(request: IgnoreEventsRequest, runtime: Util.RuntimeOptions): IgnoreEventsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.eventUuids)) {
    query['EventUuids'] = request.eventUuids;
  }
  if (!Util.isUnset(request.handleStyle)) {
    query['HandleStyle'] = request.handleStyle;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'IgnoreEvents',
    version = '2020-06-13',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function ignoreEvents(request: IgnoreEventsRequest): IgnoreEventsResponse {
  var runtime = new Util.RuntimeOptions{};
  return ignoreEventsWithOptions(request, runtime);
}

model ProduceAikcertRequest {
  aikName?: string(name='AikName', example='AAv9r6m9********rDg/0g=='),
  certRequest?: string(name='CertRequest', example='-----BEGIN CERTIFICATE REQUEST-----
*******************
*******************
*******************
*******************
-----END CERTIFICATE REQUEST-----'),
  ekCert?: string(name='EkCert', example='-----BEGIN CERTIFICATE-----
*******************
*******************
*******************
*******************
-----END CERTIFICATE-----'),
  ekPubKey?: string(name='EkPubKey', example='-----BEGIN PUBLIC KEY-----
*******************
*******************
*******************
*******************
-----END PUBLIC KEY-----'),
  includeCertChain?: boolean(name='IncludeCertChain', example='false'),
}

model ProduceAikcertResponseBody = {
  data?: {
    dataCredentialBlob?: string(name='DataCredentialBlob', example='AAAJ8Cmk********CWWemg=='),
    keyCredentialBlob?: string(name='KeyCredentialBlob', example='utzA3gAA********eVEpFNs='),
  }(name='Data'),
  requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3****'),
}

model ProduceAikcertResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ProduceAikcertResponseBody(name='body'),
}

async function produceAikcertWithOptions(request: ProduceAikcertRequest, runtime: Util.RuntimeOptions): ProduceAikcertResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.aikName)) {
    query['AikName'] = request.aikName;
  }
  if (!Util.isUnset(request.certRequest)) {
    query['CertRequest'] = request.certRequest;
  }
  if (!Util.isUnset(request.ekCert)) {
    query['EkCert'] = request.ekCert;
  }
  if (!Util.isUnset(request.ekPubKey)) {
    query['EkPubKey'] = request.ekPubKey;
  }
  if (!Util.isUnset(request.includeCertChain)) {
    query['IncludeCertChain'] = request.includeCertChain;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ProduceAikcert',
    version = '2020-06-13',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function produceAikcert(request: ProduceAikcertRequest): ProduceAikcertResponse {
  var runtime = new Util.RuntimeOptions{};
  return produceAikcertWithOptions(request, runtime);
}

model PutMessageRequest {
  fileData?: string(name='FileData', example='<quote>
  <version>5364b9c65d069c43898de1e8cd0b7815914c6b7b</version>
  <type>ALI_TRUST_ALIYUN_TPM</type>
  <data>
    <aik_cert>LS0tLS1C********LS0tLS0K</aik_cert>
    <quote_message>/1RDR4AY********2kaJ6w==</quote_message>
    <quote_signature>Tn5nuDQe********xNtnQw==</quote_signature>
    <pcr_list>Mo1hSigO********v3Trjsc=</pcr_list>
    <ima_list>CgAAAN7G********AAAAAAA=</ima_list>
    <user>
      <property_uuid>0f74b5cc-ff0e-4fa6-b457-1dc58072****</property_uuid>
      <policy>
        <conditions></conditions>
        <effect>ALI_TRUST_ATTEST_EFFECT_IGNORE</effect>
        <action>ALI_TRUST_ATTEST_ACTION_DO_NOTHING</action>
      </policy>
      <nonce>1665216049780185</nonce>
    </user>
  </data>
</quote>'),
  propertyUuid?: string(name='PropertyUuid', example='0f74b5cc-ff0e-4fa6-b457-1dc58072****'),
}

model PutMessageResponseBody = {
  requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3****'),
  data?: {
    kmoduleVerificationResult?: {
      code?: string(name='code', example='null'),
      status?: int32(name='status', example='null'),
    }(name='kmoduleVerificationResult'),
    nextClientIMAIndex?: long(name='nextClientIMAIndex', example='0'),
    policyProcResult?: {
      code?: string(name='code', example='null'),
      procData?: string(name='procData', example='null'),
    }(name='policyProcResult'),
    programVerificationResult?: {
      code?: string(name='code', example='TrustedStatus'),
      status?: int32(name='status', example='1'),
    }(name='programVerificationResult'),
    systemVerificationResult?: {
      code?: string(name='code', example='TrustedStatus'),
      status?: int32(name='status', example='1'),
    }(name='systemVerificationResult'),
  }(name='data'),
}

model PutMessageResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PutMessageResponseBody(name='body'),
}

async function putMessageWithOptions(request: PutMessageRequest, runtime: Util.RuntimeOptions): PutMessageResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.fileData)) {
    query['FileData'] = request.fileData;
  }
  if (!Util.isUnset(request.propertyUuid)) {
    query['PropertyUuid'] = request.propertyUuid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'PutMessage',
    version = '2020-06-13',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function putMessage(request: PutMessageRequest): PutMessageResponse {
  var runtime = new Util.RuntimeOptions{};
  return putMessageWithOptions(request, runtime);
}

model RegisterMessageRequest {
  extensions?: string(name='Extensions'),
  instanceId?: string(name='InstanceId'),
  instanceType?: string(name='InstanceType'),
  propertyAffiliation?: int32(name='PropertyAffiliation'),
  propertyName?: string(name='PropertyName'),
  propertyPrivateIp?: string(name='PropertyPrivateIp'),
  propertyPublicIp?: string(name='PropertyPublicIp'),
  propertyUuid?: string(name='PropertyUuid'),
}

model RegisterMessageResponseBody = {
  requestId?: string(name='RequestId'),
}

model RegisterMessageResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: RegisterMessageResponseBody(name='body'),
}

async function registerMessageWithOptions(request: RegisterMessageRequest, runtime: Util.RuntimeOptions): RegisterMessageResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.extensions)) {
    query['Extensions'] = request.extensions;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.instanceType)) {
    query['InstanceType'] = request.instanceType;
  }
  if (!Util.isUnset(request.propertyAffiliation)) {
    query['PropertyAffiliation'] = request.propertyAffiliation;
  }
  if (!Util.isUnset(request.propertyName)) {
    query['PropertyName'] = request.propertyName;
  }
  if (!Util.isUnset(request.propertyPrivateIp)) {
    query['PropertyPrivateIp'] = request.propertyPrivateIp;
  }
  if (!Util.isUnset(request.propertyPublicIp)) {
    query['PropertyPublicIp'] = request.propertyPublicIp;
  }
  if (!Util.isUnset(request.propertyUuid)) {
    query['PropertyUuid'] = request.propertyUuid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RegisterMessage',
    version = '2020-06-13',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function registerMessage(request: RegisterMessageRequest): RegisterMessageResponse {
  var runtime = new Util.RuntimeOptions{};
  return registerMessageWithOptions(request, runtime);
}

model TrustEventsRequest {
  eventUuids?: string(name='EventUuids', example='["14e055e60c8c19264a4c0045feee****"]'),
  handleStyle?: int32(name='HandleStyle', example='1'),
}

model TrustEventsResponseBody = {
  data?: string(name='Data', example='{}'),
  requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3****'),
}

model TrustEventsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: TrustEventsResponseBody(name='body'),
}

async function trustEventsWithOptions(request: TrustEventsRequest, runtime: Util.RuntimeOptions): TrustEventsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.eventUuids)) {
    query['EventUuids'] = request.eventUuids;
  }
  if (!Util.isUnset(request.handleStyle)) {
    query['HandleStyle'] = request.handleStyle;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'TrustEvents',
    version = '2020-06-13',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function trustEvents(request: TrustEventsRequest): TrustEventsResponse {
  var runtime = new Util.RuntimeOptions{};
  return trustEventsWithOptions(request, runtime);
}

model UnregisterMessageRequest {
  properties?: string(name='Properties', example='["0f74b5cc-ff0e-4fa6-b457-1dc58072****"]'),
}

model UnregisterMessageResponseBody = {
  requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3****'),
}

model UnregisterMessageResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UnregisterMessageResponseBody(name='body'),
}

async function unregisterMessageWithOptions(request: UnregisterMessageRequest, runtime: Util.RuntimeOptions): UnregisterMessageResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.properties)) {
    query['Properties'] = request.properties;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UnregisterMessage',
    version = '2020-06-13',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function unregisterMessage(request: UnregisterMessageRequest): UnregisterMessageResponse {
  var runtime = new Util.RuntimeOptions{};
  return unregisterMessageWithOptions(request, runtime);
}

model VerifyMessageRequest {
  fileData?: string(name='FileData'),
}

model VerifyMessageResponseBody = {
  data?: {
    imaVerificationResult?: {
      code?: string(name='Code'),
      status?: int32(name='Status'),
      tcbObsolete?: [ string ](name='TcbObsolete'),
      untrusted?: [ string ](name='Untrusted'),
    }(name='ImaVerificationResult'),
    pcrVerificationResult?: {
      code?: string(name='Code'),
      status?: int32(name='Status'),
      tcbObsolete?: [ string ](name='TcbObsolete'),
      untrusted?: [ string ](name='Untrusted'),
    }(name='PcrVerificationResult'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model VerifyMessageResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: VerifyMessageResponseBody(name='body'),
}

async function verifyMessageWithOptions(request: VerifyMessageRequest, runtime: Util.RuntimeOptions): VerifyMessageResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.fileData)) {
    body['FileData'] = request.fileData;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'VerifyMessage',
    version = '2020-06-13',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'Anonymous',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function verifyMessage(request: VerifyMessageRequest): VerifyMessageResponse {
  var runtime = new Util.RuntimeOptions{};
  return verifyMessageWithOptions(request, runtime);
}

